import { message as antMessage } from 'antd';

export const Messages = {
  success: (message: string, key?: string) => {
    antMessage.success({
      content: message,
      key,
    });
  },
  /**
   * 代表错误的信息如果有key则表明为单例其他会被直接删除掉
   *
   * @param {string} message - The error message to display.
   * @param {string} [key] - Optional key to identify the message.
   */
  error: (message: string, key?: string) => {
    antMessage.error({
      content: message,
      key,
    });
  },
  warning: (message: string, key?: string) => {
    antMessage.warning({
      content: message,
      key,
    });
  },
  loading: (message: string, key?: string) => {
    antMessage.loading({
      content: message,
      key,
    });
  },
  destroyLoading: () => {},
};
